program BottlesOfBeer (output);
{this program plays the 99 bottles of beer song}

const
  BOTTLESSTART = 99;
  BOTTLESEND = 1;

type
  tBottles = BOTTLESEND..BOTTLESSTART;

var
  bottles : tBottles;

begin
  for bottles := BOTTLESSTART downto BOTTLESEND do
  begin
    if bottles > 1 then
    begin
      writeln (bottles,' bottles of beer on the wall. ',bottles, ' bottles of beer.');
      write ('Take one down and pass it around. ');
      if bottles = 2 then
        writeln ('1 bottle of beer on the wall.')
      else
        writeln (bottles - 1, ' bottles of beer on the wall.');
      writeln
    end
    else
    begin
      writeln ('1 bottle of beer on the wall. 1 bottle of beer.');
      writeln ('Take one down and pass it around. no more bottles of beer on the wall.');
      writeln;
      writeln ('No more bottles of beer on the wall. no more bottles of beer.');
      writeln ('Go to the store and buy some more. 99 bottles of beer on the wall.');
      writeln
    end
  end
end.
